# s1 = str("helloworld")
# print(s1)
# s2 = """Peter said,"I'll go home!\""""
# print(s2)
#
# s = "1+2=%d，结果是%s的，但是小明说：%r" % (3, "正确", '这是错误的。')
# print(s)

# from operator import itemgetter
# var_list = [
#     (11, 22, 33, 44),
#     (12, 34, 45, 90),
#     (18, 38, 90, 16),
#     (78, 34, 65, 23),
#     (17, 41, 72, 40)
# ]
# news = sorted(var_list,key=itemgetter(3))
# print(news)

# vars = ('千分位={0:,} '
#         '保留小数位={1:.3f} '
#         '八进制={2:#o} '
#         '小写十六进制={3:#x} '
#         '二进制格式={4:b} '
#         '整数转Unicode字符={5:c}'
#         .format(12345678, 1 / 3, 20, 500, 1000, 20013))
# print(vars)

# vars = "我叫{name},我今年{age}岁了！".format(name="Jim", age=35)
# print(vars)

# 字符串常用方法
# s = "hellowor lDh"
# list1 = list(s)         # 字符串转list对象
# s1 = s[-5:-1]           # 字符串切片
# s2 = "*".join(s)        # 字符串join用法
# int1 = s.index('w')     # 字符或子字符串索引
# int2 = s.count('l')     # 字符出现次数
# s3 = s.lower()          # 字符串转小写
# s4 = s.strip()          # 无参：返回一个删除前导和尾随空格的新字符串
# s5 = s.strip('h')       # 有参：返回一个删除前导和尾随制定字符的新字符串
# s6 = s.split('o',2) # maxsplit:means切几次,=2, means用'o'切2次，即生成3个子字符串
# print(s6)

from string import ascii_letters
from random import choice

letters = 'looking at the crowded street, hiding from the rain and snow, trying to forget but I won\'t let go.'
print(letters.partition('the'))
